home *** CD-ROM | disk | FTP | other *** search
- property pSprite, pLocOffset, pActive, pConstrained
-
- on beginSprite me
- pSprite = sprite(me.spriteNum)
- vMember = pSprite.member
- case vMember.type of
- #animGif, #flash, #quickTimeMedia, #digitalVideo, #vectorShape:
- if vMember.directToStage then
- alert("Sprite" && pSprite.spriteNum & ": Direct To Stage media may cause" && "playback problems with the 'Moveable Sprite' behavior.")
- end if
- end case
- pActive = 0
- end
-
- on mouseUp me
- mDrag(0)
- end
-
- on mouseDown me
- mDrag(1)
- end
-
- on prepareFrame me
- if the mouseUp then
- mDrag(0)
- end if
- if pActive then
- mDragSprite(me)
- end if
- end
-
- on mDrag vActive
- pActive = vActive
- pLocOffset = pSprite.loc - the mouseLoc
- sendAllSprites(#Active_Sprite, the currentSpriteNum * pActive)
- end
-
- on mDragSprite
- pSprite.loc = the mouseLoc + pLocOffset
- if pConstrained then
- vLeftDiff = pSprite.rect.left
- if vLeftDiff < 0 then
- pSprite.locH = pSprite.locH - vLeftDiff
- end if
- vRightDiff = pSprite.rect.right - (the stage).rect.width
- if vRightDiff > 0 then
- pSprite.locH = pSprite.locH - vRightDiff
- end if
- vTopDiff = pSprite.rect.top
- if vTopDiff < 0 then
- pSprite.locV = pSprite.locV - vTopDiff
- end if
- vBottomDiff = pSprite.rect.bottom - (the stage).rect.height
- if vBottomDiff > 0 then
- pSprite.locV = pSprite.locV - vBottomDiff
- end if
- end if
- end
-
- on Forwarded_mouseDown me
- if not pActive then
- mDrag(1)
- end if
- return the currentSpriteNum
- end
-
- on isOKToAttach me, aSpriteType, aSpriteNum
- return aSpriteType = #graphic
- end
-
- on getPropertyDescriptionList
- vPDList = [:]
- setaProp(vPDList, #pConstrained, [#comment: "Constrain to stage", #format: #boolean, #default: 1])
- return vPDList
- end
-